package com.yedean.mall.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yedean.mall.entity.PmsSkuStock;
import com.yedean.mall.mapper.PmsSkuStockMapper;
import com.yedean.mall.service.IPmsSkuStockService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * sku的库存 服务实现类
 * </p>
 *
 * @author yedean
 * @since 2022-08-09
 */
@Service
public class PmsSkuStockServiceImpl extends ServiceImpl<PmsSkuStockMapper, PmsSkuStock> implements IPmsSkuStockService {

    @Override
    public List<PmsSkuStock> getList(Long pid, String keyword) {
        LambdaUpdateWrapper<PmsSkuStock> wrapper = new LambdaUpdateWrapper<>();
        wrapper.eq(PmsSkuStock::getProductId,pid);
        if (StrUtil.isNotBlank(keyword)){
            wrapper.like(PmsSkuStock::getSkuCode,keyword);
        }
        
        return baseMapper.selectList(wrapper);
    }
    
}
